#!/bin/bash
set -ex
remote="$1"
shift 1
branch="`git-branch-current`"
set +x

echo "Warning: about to roll back to ${remote}/${branch}. Stash your changes before doing this."
read -r -p "Continue? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
  :
else
  exit 1
fi

set -ex
git fetch "${remote}"
#git stash
git reset --hard "${remote}/${branch}"
#git stash pop
git status


